﻿using System;
using System.Windows.Controls;
using System.Windows.Threading;
using Framework.Net.Xmpp.InstantMessaging;
using XClient.Interfaces;
using XClient.ViewModels;
using Microsoft.Practices.Unity;

namespace XClient.Views
{
    /// <summary>
    /// Interaction logic for LoginView.xaml
    /// </summary>
    public partial class LoginView : UserControl, ILoginView
    {
        #region · Fields ·

        private Dispatcher      dispatcher;
        private LoginViewModel  viewModel;

        #endregion

        #region · Properties ·

        public LoginViewModel ViewModel
        {
            get { return this.viewModel; }
            private set
            {
                this.viewModel      = value;
                this.DataContext    = value;
            }
        }

        #endregion

        #region · Constructors ·

        public LoginView(IUnityContainer container)
        {
            InitializeComponent();

            this.ViewModel = container.Resolve<LoginViewModel>();
        }

        #endregion

        #region · Event Handlers ·

        private void LoginButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            this.ViewModel.DoLogin();
        }

        #endregion
    }
}
